import * as THREE from "three";

/**
 * 岩浆球体
 */
export class Magma extends THREE.Object3D {
  private readonly _map: THREE.Texture;

  constructor() {
    super();

    const loader = new THREE.TextureLoader();
    const map = loader.load("/public/img/lanse.jfif");

    const mesh = new THREE.Mesh(
      new THREE.SphereGeometry(2, 40, 40),
      new THREE.MeshBasicMaterial({ map })
    );
    this.add(mesh);

    map.wrapS = map.wrapT = THREE.RepeatWrapping;

    this._map = map;
  }


  public update() {
    this._map.offset.x = performance.now() / 1000 / 2;
    this._map.offset.y = performance.now() / 1000 / 2.5;
  }
}
